package jsyf.oa.web.wechat.service_company;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import jsyf.com.util.ResponseUtils;
import jsyf.oa.facade.wechat.service_company.WechatSynchronizationFacade;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by jjx on 2018/3/23.
 */
@Api(value = "一键同步通讯录", description = "一键同步通讯录")
@Controller
@RequestMapping("/wechatSynchronizationContacts")
public class WechatSynchronizationContactsController {
    @Resource
    private WechatSynchronizationFacade wechatSynchronizationFacade;

    @ApiOperation(
            value = "一键同步公司部门职员",
            notes = "保持给公司信息和微信完全一致",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "无参数", dataType = "String", paramType = "body")
    @RequestMapping(value = "/touchSynchronization.json", method = RequestMethod.POST)
    public void touchSynchronization(HttpServletResponse response, @RequestBody String jsonData) throws Exception{
        String result =wechatSynchronizationFacade.touchSynchronization(jsonData);
        ResponseUtils.putJsonResponse(response, result);
    }

}
